package com.example.saiaadmin.controller;
import com.example.saiaadmin.entry.EbSystemMenu;
import com.example.saiaadmin.service.EbSystemMenuService;
import com.example.saiaadmin.utils.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.List;

/**
 * 菜单信息表Controller
 *
 *  @author  Vagrant
 * @since 2025/01/13
 */
@RestController
@RequestMapping("/eb-system-menu")
public class EbSystemMenuController {

    @Autowired
    private EbSystemMenuService service;

    @GetMapping("/listMenu")
    public ResultData<List<EbSystemMenu>> listMenu(){
        EbSystemMenu ebSystemMenu = new EbSystemMenu();
        List<EbSystemMenu> list = service.listMenu(ebSystemMenu);
        return ResultData.success("查询成功",list);
    }

    @GetMapping("/index")
    public ResultData<List<EbSystemMenu>> index(Integer page,Integer limit,String name,String code,Integer status){
        EbSystemMenu ebSystemMenu = new EbSystemMenu();
        ebSystemMenu.setName(name);
        ebSystemMenu.setCode(code);
        ebSystemMenu.setStatus(status);
        List<EbSystemMenu> list = service.listMenu(ebSystemMenu);
        return ResultData.success("查询成功",list);
    }

}
